package org.beetl.support;

import java.util.Properties;

import jodd.petite.PetiteContainer;

public class PetiteIocContainer implements IocContainer {

 PetiteContainer container;

 public PetiteIocContainer() {
  this(new PetiteContainer());
 }

 public PetiteIocContainer(PetiteContainer container) {
  super();
  this.container = container;
 }

 public PetiteContainer getContainer() {
  return container;
 }

 
 public void init(Properties params) {
 }

 
 public Object getBean(String name) {
  return this.getContainer().getBean(name);
 }

 
 public <T> T getBean(Class<T> clasz) {
  T bean = this.getContainer().getBean(clasz);
  if (bean == null) {
   this.getContainer().registerPetiteBean(clasz, null, null, null, false);
  }
  return this.getContainer().getBean(clasz);
 }

 
 public void shutdown() {
  this.getContainer().shutdown();
 }

}
